﻿using System;

public enum ItemsTypes { button, label, dropdown, spectator};
public enum ItemsStyles { image, imageandtext, text };

namespace Toolbar_Editor_Plugin
{
    public class ToolbarItems : System.Windows.Forms.TreeNode
    {
        public ItemsTypes ItemType;
        public String ItemCode;
        public ItemsStyles ItemStyle;
        public String ItemImage;

        public ToolbarItems(String pText, String pCode, ItemsStyles pStyle, String pImage)
        {
            Text = pText;
            ItemCode = pCode;
            ItemStyle = pStyle;
            ItemType = ItemsTypes.button;
            ItemImage = pImage;
            SetIcon();
        }
        public ToolbarItems(String pText ,String pCode,ItemsStyles pStyle,ItemsTypes pType,String pImage){
            Text = pText;
            ItemCode = pCode;
            ItemStyle = pStyle;
            ItemType = pType;
            ItemImage = pImage;
            SetIcon();
        }
        public ToolbarItems(ItemsTypes pType)
        {
            ItemType = pType;
            ItemCode = null;
            ItemStyle = ItemsStyles.imageandtext;
            ItemImage = null;
            switch (ItemType)
            {
                case ItemsTypes.button:
                    Text = "New button";
                    break;
                case ItemsTypes.label:
                    Text = "New label";
                    break;
                case ItemsTypes.dropdown:
                    Text = "New dropdown";
                    break;
                case ItemsTypes.spectator:
                    Text = "Seperator";
                    break;
            }
            SetIcon();
        }
        public void SetIcon()
        {
            switch (ItemType)
            {
                case ItemsTypes.button :
                    this.ImageKey = SelectedImageKey = "button";
                    break;
                case ItemsTypes.label:
                    this.ImageKey = SelectedImageKey =  "label";
                    break;
                case ItemsTypes.dropdown:
                    this.ImageKey = SelectedImageKey = "dropdown";
                    break;
                case ItemsTypes.spectator:
                    this.ImageKey = SelectedImageKey = "spectator";
                    break;
            }
        }
    }
}
